<!DOCTYPE html>
<html>

<head>
    <title>资金流水</title>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0,maximum-scale=1,user-scalable=no">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="telephone=no" name="format-detection">
    <link rel="stylesheet" type="text/css" href="/resource/web/css/reset.css">
    <link rel="stylesheet" type="text/css" href="/resource/web/css/flex.css">
    <link rel="stylesheet" type="text/css" href="/resource/web/css/dropload.css">
    <link rel="stylesheet" type="text/css" href="/resource/web/css/accounts-child.css">
    <script type="text/javascript" src="/resource/web/js/flexible.js"></script>
    <script type="text/javascript" src="/resource/web/js/jquery-1.11.1.min.js"></script>
</head>

<body>
    <div class="mod-tit">
        <div class="title">
            <p>资金流水</p>
            <a href="/Web/user_accounts" onclick=""><img class="back" src="/resource/web/img/newhead/path_7_copy.png"></a>
        </div>
        <div class="cpfl">
            <ul class="cpfl-ul tcf-flex tcf-justify-center">
                <a href="/Web/money_record.html"><li class="cpfl-red all" id="">全部</li></a>
                <a href="/Web/cz_money_record.html"><li id="aaa">充值</li></a>
                <a href="/Web/tx_money_record.html"><li id="bbb">提现</li></a>
                <a href="/Web/tz_money_record.html"><li id="ccc">投资</li></a>
                <a href="/Web/hk_money_record.html"><li id="ddd">回款</li></a>
            </ul>
        </div>
    </div>
    <div class="modcpfs">
        <div class="mod-cpfl contents">
                <div class="lists"></div>
        <!-- 流水列表 -->
        </div>
    </div>

    <!-- 无消息显示 -->
    <div class="mod-not3">
        <p><img src="/resource/web/img/account/no_msg.png"></p>
    </div>
<script src="/resource/web/js/dropload.min.js"></script>
<script type="text/javascript">
    function getLocalTime(nS) {
        var dateStr=new Date(parseInt(nS) * 1000).toLocaleDateString();
        dateStr=dateStr.replace(/年|月/g, "/").replace(/日/g,"");
        var month = (new Date(dateStr)).getMonth() + 1;
        var year = (new Date(dateStr)).getFullYear();
        var date = (new Date(dateStr)).getDate();
        if (month < 10) {
            month = '0' + month;
        }
        if (date < 10) {
            date = '0' + date;
        }
        return year+"-"+month+"-"+date;
    }
    $("#ddd").addClass("cpfl-red").parents().siblings().find("li").removeClass("cpfl-red");
    //
    $(function(){
        // 页数
        var page = 0;
        // 每页展示5个
        //var size = 10;
        // dropload
        $('.contents').dropload({
            scrollArea : window,
            loadDownFn : function(me){
                console.log(me)
                page++;
                var result = "";
                $.ajax({
                    type: 'get',
                    processData: false,
                    url: 'https://www.gangpiaowang.com/Web/money_record_ajax?page='+page+'&type=IN_REFUND',
                    dataType: 'json',
                    success: function(data){
                        var arrLen = data;
                        // console.log(arrLen);

                        if(arrLen.length > 0){
                            $(".mod-not3").hide();
                            for(var i=0; i<arrLen.length; i++) {
                                console.log(arrLen[i].type);
                                //console.log( arrLen[i].event_id );
                                result += '<div class="cpfl-list"><ul class="cpfl-ls tcf-flex tcf-justify-justify"><li>'
                                        + '<p class="cp-tit">' + arrLen[i].type + '</p><p class="cp-tim">' + getLocalTime(arrLen[i].add_time) + '</p></li>'
                                        + '<li><p class="cp-num">' + arrLen[i].amount + '</p><p class="cp-ye">账户余额：' + arrLen[i].update_after + '</p></li></ul></div>'
                            }
                            // 如果没有数据
                        }else{
                            // 锁定
                            me.lock();
                            // 无数据
                            me.noData();
                        }
                        $('.lists').append(result);
                        me.resetload();

                        // 为了测试，延迟1秒加载
                        /*setTimeout(function(){
                         // 插入数据到页面，放到最后面
                         $('.lists').append(result);
                         // 每次数据插入，必须重置
                         me.resetload();
                         },1000);*/
                    },
                    error: function(xhr, type){
                        console.log('Ajax error!');
                        // 即使加载出错，也得重置
                        me.resetload();
                    }
                });

            }
        });
    })


</script>
</body>

</html>
